

<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
    <style>
    /* base */
    html,
    body,
    .container {
      width: 100%;
      height: 100%;
    }

    a,
    a:link,
    a:visited {
      text-decoration: none;
      color: inherit;
    }

    ul {
      list-style: none;
    }

    *,
    ::before,
    ::after {
      box-sizing: border-box;
      margin: 0;
      padding: 0;
    }

    *:focus {
      outline: 0;
    }

    .container {
      display: flex;
      padding-top: 20px;
    }

    /* Nav */
    .container .doc-nav {
      position: fixed;
      height: 100%;
      margin: 0 30px 0 40px;
      width: 280px;
    }

    .doc-nav .nav-header {
      display: flex;
      align-items: center;
      box-sizing: border-box;
      background-color: rgb(240, 241, 242);
      height: 40px;
      padding: 16px;
      font-size: 18px;
      font-weight: 500;
      color: rgb(62, 64, 66);
      cursor: pointer;
    }

    .doc-nav .nav-content {
      height: calc(100% - 40px);
      overflow-y: auto;
      color: rgb(32, 34, 36);
    }

    .doc-nav .nav-content .nav-list,
    .doc-nav .nav-content .nav-sub-list {
      line-height: 1.5rem;
    }

    .doc-nav .nav-content .nav-label {
      display: inline-block;
      position: relative;
      padding: 2px 0 2px 20px;
      margin-bottom: 4px;
    }

    .doc-nav .nav-content .nav-sub-label {
      position: relative;
      padding: 2px 0 2px 40px;
      font-size: 14px;
    }

    .doc-nav .nav-content .nav-sub-label:hover {
      text-decoration: underline;
    }

    .doc-nav .nav-content .nav-list .nav-label.group::before {
      border-bottom: 0.25rem solid transparent;
      border-left: 0.25rem solid #6e7072;
      border-right: 0;
      border-top: 0.25rem solid transparent;
      content: '';
      display: block;
      height: 0;
      left: 0.5rem;
      position: absolute;
      top: 0.625rem;
      transition: transform 0.1s linear;
      width: 0;
    }

    .doc-nav .nav-content .nav-list .nav-label.group.active::before {
      transform: rotate(90deg);
    }

    /* doc content */
    .container .doc-content {
      position: fixed;
      height: 100%;
      width: calc(100% - 80px - 40px - 30px - 240px);
      right: 0%;
      overflow-y: auto;
    }

    .doc-title {
      border-bottom: 1px solid #dcdee0;
      font-size: 22px;
      margin: 8px 0 0;
      padding-bottom: 16px;
    }

    .doc-content h3 {
      font-size: 24px;
      font-weight: 600;
      margin: 24px 0;
    }

    .doc-content h4 {
      font-size: 22px;
      font-weight: 500;
      margin: 30px 0 8px;
    }

    .doc-content h4 span {
      color: #007d9c;
    }

    .doc-content .doc-declare {
      background-color: #fafafa;
      border-radius: 5px;
      border: 1px solid #ccc;
      font-size: 14px;
      overflow-x: auto;
      padding: 10px;
      tab-size: 4;
      line-height: 20px;
    }

    .doc-content .doc-comment {
      font-size: 16px;
      margin: 16px 0;
      line-height: 24px;
      word-break: break-word;
    }
  </style>

</head>
<body>
  <div class="container">
    <div class="doc-nav">
      <a href="#Documentation" class="nav-header">Documentation</a>
      <nav class="nav-content">
        <ul class="nav-list">
          <li>
            <a href="#includes" class="nav-label">Includes</a>
             
            <ul class="nav-sub-list">

              <li>
                <a href="#config.h" class="nav-sub-label">config.h</a>
              </li>
      

              <li>
                <a href="#MBEDTLS_CONFIG_FILE" class="nav-sub-label">MBEDTLS_CONFIG_FILE</a>
              </li>
      

              <li>
                <a href="#asn1.h" class="nav-sub-label">asn1.h</a>
              </li>
      
            </ul>
            
          </li>
          <li>
            <a href="#macros" class="nav-label">Macros</a>
             
            <ul class="nav-sub-list">

              <li>
                <a href="#MBEDTLS_ASN1_WRITE_H" class="nav-sub-label">MBEDTLS_ASN1_WRITE_H</a>
              </li>
      

              <li>
                <a href="#MBEDTLS_ASN1_CHK_ADD(g, f)" class="nav-sub-label">MBEDTLS_ASN1_CHK_ADD(g, f)</a>
              </li>
      
            </ul>
            
          </li>
          <li>
            <a href="#functions" class="nav-label">Functions</a>
             
            <ul class="nav-sub-list">

              <li>
                <a href="#mbedtls_asn1_write_len" class="nav-sub-label">mbedtls_asn1_write_len</a>
              </li>
      

              <li>
                <a href="#mbedtls_asn1_write_tag" class="nav-sub-label">mbedtls_asn1_write_tag</a>
              </li>
      

              <li>
                <a href="#mbedtls_asn1_write_raw_buffer" class="nav-sub-label">mbedtls_asn1_write_raw_buffer</a>
              </li>
      

              <li>
                <a href="#mbedtls_asn1_write_mpi" class="nav-sub-label">mbedtls_asn1_write_mpi</a>
              </li>
      

              <li>
                <a href="#mbedtls_asn1_write_null" class="nav-sub-label">mbedtls_asn1_write_null</a>
              </li>
      

              <li>
                <a href="#mbedtls_asn1_write_oid" class="nav-sub-label">mbedtls_asn1_write_oid</a>
              </li>
      

              <li>
                <a href="#mbedtls_asn1_write_algorithm_identifier" class="nav-sub-label">mbedtls_asn1_write_algorithm_identifier</a>
              </li>
      

              <li>
                <a href="#mbedtls_asn1_write_bool" class="nav-sub-label">mbedtls_asn1_write_bool</a>
              </li>
      

              <li>
                <a href="#mbedtls_asn1_write_int" class="nav-sub-label">mbedtls_asn1_write_int</a>
              </li>
      

              <li>
                <a href="#mbedtls_asn1_write_tagged_string" class="nav-sub-label">mbedtls_asn1_write_tagged_string</a>
              </li>
      

              <li>
                <a href="#mbedtls_asn1_write_printable_string" class="nav-sub-label">mbedtls_asn1_write_printable_string</a>
              </li>
      

              <li>
                <a href="#mbedtls_asn1_write_utf8_string" class="nav-sub-label">mbedtls_asn1_write_utf8_string</a>
              </li>
      

              <li>
                <a href="#mbedtls_asn1_write_ia5_string" class="nav-sub-label">mbedtls_asn1_write_ia5_string</a>
              </li>
      

              <li>
                <a href="#mbedtls_asn1_write_bitstring" class="nav-sub-label">mbedtls_asn1_write_bitstring</a>
              </li>
      

              <li>
                <a href="#mbedtls_asn1_write_octet_string" class="nav-sub-label">mbedtls_asn1_write_octet_string</a>
              </li>
      
            </ul>
            
          </li>
          <li>
            <a href="#vars" class="nav-label">Vars</a>
             
            <ul class="nav-sub-list">

              <li>
                <a href="#mbedtls_asn1_named_data" class="nav-sub-label">mbedtls_asn1_named_data</a>
              </li>
      
            </ul>
            
          </li>
          <li>
            <a href="#consts" class="nav-label">Consts</a>
            
            <ul class="nav-sub-list">
            
            </ul>
            
          </li>
          <li>
            <a href="#types" class="nav-label">Types</a>
            
            <ul class="nav-sub-list">
            
            </ul>
            
          </li>
          <li>
            <a href="#typedefs" class="nav-label">Typedefs</a>
            
            <ul class="nav-sub-list">
            
            </ul>
            
          </li>
        </ul>
      </nav>
    </div>
    <div class="doc-content">
      <h2 id="Documentation" class="doc-title">Documentation</h2>
      <h3 id="includes">Includes</h3>
      

      <h4 id="config.h"><span>config.h</span></h4>
      <pre class="doc-declare"><code>#include "config.h"
</code></pre>
      <pre class="doc-comment">#include "config.h"
</pre>

      <h4 id="MBEDTLS_CONFIG_FILE"><span>MBEDTLS_CONFIG_FILE</span></h4>
      <pre class="doc-declare"><code>#include MBEDTLS_CONFIG_FILE
</code></pre>
      <pre class="doc-comment">#include MBEDTLS_CONFIG_FILE
</pre>

      <h4 id="asn1.h"><span>asn1.h</span></h4>
      <pre class="doc-declare"><code>#include "asn1.h"
</code></pre>
      <pre class="doc-comment">#include "asn1.h"
</pre>
      <h3 id="macros">Macros</h3>
      

      <h4 id="MBEDTLS_ASN1_WRITE_H">Marco <span>MBEDTLS_ASN1_WRITE_H</span></h4>
      <pre class="doc-declare"><code>#define MBEDTLS_ASN1_WRITE_H
</code></pre>
      <pre class="doc-comment"></pre>

      <h4 id="MBEDTLS_ASN1_CHK_ADD(g, f)">Marco <span>MBEDTLS_ASN1_CHK_ADD(g, f)</span></h4>
      <pre class="doc-declare"><code>#define MBEDTLS_ASN1_CHK_ADD(g, f)                     \
   do                                                 \
   {                                                  \
       if( ( ret = (f) ) < 0 )                        \
           return( ret );                             \
       else                                           \
           (g) += ret;                                \
   } while( 0 )
</code></pre>
      <pre class="doc-comment"></pre>
      <h3 id="functions">Functions</h3>
      

      <h4 id="mbedtls_asn1_write_len">Func <span>mbedtls_asn1_write_len</span></h4>
      <pre class="doc-declare"><code>int mbedtls_asn1_write_len( unsigned char **p, unsigned char *start,
                           size_t len );</code></pre>
      <pre class="doc-comment">/**
 * \brief           Write a length field in ASN.1 format.
 *
 * \note            This function works backwards in data buffer.
 *
 * \param p         The reference to the current position pointer.
 * \param start     The start of the buffer, for bounds-checking.
 * \param len       The length value to write.
 *
 * \return          The number of bytes written to \p p on success.
 * \return          A negative \c MBEDTLS_ERR_ASN1_XXX error code on failure.
 */</pre>

      <h4 id="mbedtls_asn1_write_tag">Func <span>mbedtls_asn1_write_tag</span></h4>
      <pre class="doc-declare"><code>int mbedtls_asn1_write_tag( unsigned char **p, unsigned char *start,
                           unsigned char tag );</code></pre>
      <pre class="doc-comment">/**
 * \brief           Write an ASN.1 tag in ASN.1 format.
 *
 * \note            This function works backwards in data buffer.
 *
 * \param p         The reference to the current position pointer.
 * \param start     The start of the buffer, for bounds-checking.
 * \param tag       The tag to write.
 *
 * \return          The number of bytes written to \p p on success.
 * \return          A negative \c MBEDTLS_ERR_ASN1_XXX error code on failure.
 */</pre>

      <h4 id="mbedtls_asn1_write_raw_buffer">Func <span>mbedtls_asn1_write_raw_buffer</span></h4>
      <pre class="doc-declare"><code>int mbedtls_asn1_write_raw_buffer( unsigned char **p, unsigned char *start,
                                  const unsigned char *buf, size_t size );</code></pre>
      <pre class="doc-comment">/**
 * \brief           Write raw buffer data.
 *
 * \note            This function works backwards in data buffer.
 *
 * \param p         The reference to the current position pointer.
 * \param start     The start of the buffer, for bounds-checking.
 * \param buf       The data buffer to write.
 * \param size      The length of the data buffer.
 *
 * \return          The number of bytes written to \p p on success.
 * \return          A negative \c MBEDTLS_ERR_ASN1_XXX error code on failure.
 */</pre>

      <h4 id="mbedtls_asn1_write_mpi">Func <span>mbedtls_asn1_write_mpi</span></h4>
      <pre class="doc-declare"><code>int mbedtls_asn1_write_mpi( unsigned char **p, unsigned char *start,
                           const mbedtls_mpi *X );</code></pre>
      <pre class="doc-comment">/**
 * \brief           Write a arbitrary-precision number (#MBEDTLS_ASN1_INTEGER)
 *                  in ASN.1 format.
 *
 * \note            This function works backwards in data buffer.
 *
 * \param p         The reference to the current position pointer.
 * \param start     The start of the buffer, for bounds-checking.
 * \param X         The MPI to write.
 *
 * \return          The number of bytes written to \p p on success.
 * \return          A negative \c MBEDTLS_ERR_ASN1_XXX error code on failure.
 */</pre>

      <h4 id="mbedtls_asn1_write_null">Func <span>mbedtls_asn1_write_null</span></h4>
      <pre class="doc-declare"><code>int mbedtls_asn1_write_null( unsigned char **p, unsigned char *start );</code></pre>
      <pre class="doc-comment">/**
 * \brief           Write a NULL tag (#MBEDTLS_ASN1_NULL) with zero data
 *                  in ASN.1 format.
 *
 * \note            This function works backwards in data buffer.
 *
 * \param p         The reference to the current position pointer.
 * \param start     The start of the buffer, for bounds-checking.
 *
 * \return          The number of bytes written to \p p on success.
 * \return          A negative \c MBEDTLS_ERR_ASN1_XXX error code on failure.
 */</pre>

      <h4 id="mbedtls_asn1_write_oid">Func <span>mbedtls_asn1_write_oid</span></h4>
      <pre class="doc-declare"><code>int mbedtls_asn1_write_oid( unsigned char **p, unsigned char *start,
                           const char *oid, size_t oid_len );</code></pre>
      <pre class="doc-comment">/**
 * \brief           Write an OID tag (#MBEDTLS_ASN1_OID) and data
 *                  in ASN.1 format.
 *
 * \note            This function works backwards in data buffer.
 *
 * \param p         The reference to the current position pointer.
 * \param start     The start of the buffer, for bounds-checking.
 * \param oid       The OID to write.
 * \param oid_len   The length of the OID.
 *
 * \return          The number of bytes written to \p p on success.
 * \return          A negative \c MBEDTLS_ERR_ASN1_XXX error code on failure.
 */</pre>

      <h4 id="mbedtls_asn1_write_algorithm_identifier">Func <span>mbedtls_asn1_write_algorithm_identifier</span></h4>
      <pre class="doc-declare"><code>int mbedtls_asn1_write_algorithm_identifier( unsigned char **p,
                                            unsigned char *start,
                                            const char *oid, size_t oid_len,
                                            size_t par_len );</code></pre>
      <pre class="doc-comment">/**
 * \brief           Write an AlgorithmIdentifier sequence in ASN.1 format.
 *
 * \note            This function works backwards in data buffer.
 *
 * \param p         The reference to the current position pointer.
 * \param start     The start of the buffer, for bounds-checking.
 * \param oid       The OID of the algorithm to write.
 * \param oid_len   The length of the algorithm's OID.
 * \param par_len   The length of the parameters, which must be already written.
 *                  If 0, NULL parameters are added
 *
 * \return          The number of bytes written to \p p on success.
 * \return          A negative \c MBEDTLS_ERR_ASN1_XXX error code on failure.
 */</pre>

      <h4 id="mbedtls_asn1_write_bool">Func <span>mbedtls_asn1_write_bool</span></h4>
      <pre class="doc-declare"><code>int mbedtls_asn1_write_bool( unsigned char **p, unsigned char *start,
                            int boolean );</code></pre>
      <pre class="doc-comment">/**
 * \brief           Write a boolean tag (#MBEDTLS_ASN1_BOOLEAN) and value
 *                  in ASN.1 format.
 *
 * \note            This function works backwards in data buffer.
 *
 * \param p         The reference to the current position pointer.
 * \param start     The start of the buffer, for bounds-checking.
 * \param boolean   The boolean value to write, either \c 0 or \c 1.
 *
 * \return          The number of bytes written to \p p on success.
 * \return          A negative \c MBEDTLS_ERR_ASN1_XXX error code on failure.
 */</pre>

      <h4 id="mbedtls_asn1_write_int">Func <span>mbedtls_asn1_write_int</span></h4>
      <pre class="doc-declare"><code>int mbedtls_asn1_write_int( unsigned char **p, unsigned char *start, int val );</code></pre>
      <pre class="doc-comment">/**
 * \brief           Write an int tag (#MBEDTLS_ASN1_INTEGER) and value
 *                  in ASN.1 format.
 *
 * \note            This function works backwards in data buffer.
 *
 * \param p         The reference to the current position pointer.
 * \param start     The start of the buffer, for bounds-checking.
 * \param val       The integer value to write.
 *
 * \return          The number of bytes written to \p p on success.
 * \return          A negative \c MBEDTLS_ERR_ASN1_XXX error code on failure.
 */</pre>

      <h4 id="mbedtls_asn1_write_tagged_string">Func <span>mbedtls_asn1_write_tagged_string</span></h4>
      <pre class="doc-declare"><code>int mbedtls_asn1_write_tagged_string( unsigned char **p, unsigned char *start,
                                     int tag, const char *text,
                                     size_t text_len );</code></pre>
      <pre class="doc-comment">/**
 * \brief           Write a string in ASN.1 format using a specific
 *                  string encoding tag.

 * \note            This function works backwards in data buffer.
 *
 * \param p         The reference to the current position pointer.
 * \param start     The start of the buffer, for bounds-checking.
 * \param tag       The string encoding tag to write, e.g.
 *                  #MBEDTLS_ASN1_UTF8_STRING.
 * \param text      The string to write.
 * \param text_len  The length of \p text in bytes (which might
 *                  be strictly larger than the number of characters).
 *
 * \return          The number of bytes written to \p p on success.
 * \return          A negative error code on failure.
 */</pre>

      <h4 id="mbedtls_asn1_write_printable_string">Func <span>mbedtls_asn1_write_printable_string</span></h4>
      <pre class="doc-declare"><code>int mbedtls_asn1_write_printable_string( unsigned char **p,
                                        unsigned char *start,
                                        const char *text, size_t text_len );</code></pre>
      <pre class="doc-comment">/**
 * \brief           Write a string in ASN.1 format using the PrintableString
 *                  string encoding tag (#MBEDTLS_ASN1_PRINTABLE_STRING).
 *
 * \note            This function works backwards in data buffer.
 *
 * \param p         The reference to the current position pointer.
 * \param start     The start of the buffer, for bounds-checking.
 * \param text      The string to write.
 * \param text_len  The length of \p text in bytes (which might
 *                  be strictly larger than the number of characters).
 *
 * \return          The number of bytes written to \p p on success.
 * \return          A negative error code on failure.
 */</pre>

      <h4 id="mbedtls_asn1_write_utf8_string">Func <span>mbedtls_asn1_write_utf8_string</span></h4>
      <pre class="doc-declare"><code>int mbedtls_asn1_write_utf8_string( unsigned char **p, unsigned char *start,
                                   const char *text, size_t text_len );</code></pre>
      <pre class="doc-comment">/**
 * \brief           Write a UTF8 string in ASN.1 format using the UTF8String
 *                  string encoding tag (#MBEDTLS_ASN1_PRINTABLE_STRING).
 *
 * \note            This function works backwards in data buffer.
 *
 * \param p         The reference to the current position pointer.
 * \param start     The start of the buffer, for bounds-checking.
 * \param text      The string to write.
 * \param text_len  The length of \p text in bytes (which might
 *                  be strictly larger than the number of characters).
 *
 * \return          The number of bytes written to \p p on success.
 * \return          A negative error code on failure.
 */</pre>

      <h4 id="mbedtls_asn1_write_ia5_string">Func <span>mbedtls_asn1_write_ia5_string</span></h4>
      <pre class="doc-declare"><code>int mbedtls_asn1_write_ia5_string( unsigned char **p, unsigned char *start,
                                  const char *text, size_t text_len );</code></pre>
      <pre class="doc-comment">/**
 * \brief           Write a string in ASN.1 format using the IA5String
 *                  string encoding tag (#MBEDTLS_ASN1_IA5_STRING).
 *
 * \note            This function works backwards in data buffer.
 *
 * \param p         The reference to the current position pointer.
 * \param start     The start of the buffer, for bounds-checking.
 * \param text      The string to write.
 * \param text_len  The length of \p text in bytes (which might
 *                  be strictly larger than the number of characters).
 *
 * \return          The number of bytes written to \p p on success.
 * \return          A negative error code on failure.
 */</pre>

      <h4 id="mbedtls_asn1_write_bitstring">Func <span>mbedtls_asn1_write_bitstring</span></h4>
      <pre class="doc-declare"><code>int mbedtls_asn1_write_bitstring( unsigned char **p, unsigned char *start,
                                 const unsigned char *buf, size_t bits );</code></pre>
      <pre class="doc-comment">/**
 * \brief           Write a bitstring tag (#MBEDTLS_ASN1_BIT_STRING) and
 *                  value in ASN.1 format.
 *
 * \note            This function works backwards in data buffer.
 *
 * \param p         The reference to the current position pointer.
 * \param start     The start of the buffer, for bounds-checking.
 * \param buf       The bitstring to write.
 * \param bits      The total number of bits in the bitstring.
 *
 * \return          The number of bytes written to \p p on success.
 * \return          A negative error code on failure.
 */</pre>

      <h4 id="mbedtls_asn1_write_octet_string">Func <span>mbedtls_asn1_write_octet_string</span></h4>
      <pre class="doc-declare"><code>int mbedtls_asn1_write_octet_string( unsigned char **p, unsigned char *start,
                                    const unsigned char *buf, size_t size );</code></pre>
      <pre class="doc-comment">/**
 * \brief           Write an octet string tag (#MBEDTLS_ASN1_OCTET_STRING)
 *                  and value in ASN.1 format.
 *
 * \note            This function works backwards in data buffer.
 *
 * \param p         The reference to the current position pointer.
 * \param start     The start of the buffer, for bounds-checking.
 * \param buf       The buffer holding the data to write.
 * \param size      The length of the data buffer \p buf.
 *
 * \return          The number of bytes written to \p p on success.
 * \return          A negative error code on failure.
 */</pre>
      <h3 id="vars">Vars</h3>
      

      <h4 id="mbedtls_asn1_named_data">Variable <span>mbedtls_asn1_named_data</span></h4>
      <pre class="doc-declare"><code>mbedtls_asn1_named_data *mbedtls_asn1_store_named_data( mbedtls_asn1_named_data **list,
                                       const char *oid, size_t oid_len,
                                       const unsigned char *val,
                                       size_t val_len );</code></pre>
      <pre class="doc-comment">/**
 * \brief           Create or find a specific named_data entry for writing in a
 *                  sequence or list based on the OID. If not already in there,
 *                  a new entry is added to the head of the list.
 *                  Warning: Destructive behaviour for the val data!
 *
 * \param list      The pointer to the location of the head of the list to seek
 *                  through (will be updated in case of a new entry).
 * \param oid       The OID to look for.
 * \param oid_len   The size of the OID.
 * \param val       The data to store (can be \c NULL if you want to fill
 *                  it by hand).
 * \param val_len   The minimum length of the data buffer needed.
 *
 * \return          A pointer to the new / existing entry on success.
 * \return          \c NULL if if there was a memory allocation error.
 */</pre>
      <h3 id="consts">Consts</h3>
      
      <h3 id="types">Types</h3>
      
      <h3 id="typedefs">Typedefs</h3>
      
    </div>
  </body>
</html>
            